package com.yunheone.control;

import com.yunheone.Jdbc.TeacherJdbc;
import com.yunheone.mode.TeacherUser;
import com.yunheone.view.Teach.TeachDell;
import com.yunheone.view.Teach.TeachList;
import com.yunheone.view.Teach.TeacherAdd;

import java.util.HashMap;
import java.util.Map;

/**
 * 讲师程序处理
 */
public class Teachcon {

    private static Map<String,TeacherUser> teacheruse;
    static {
        teacheruse=new HashMap<> ();//单纯的存放讲师信息，和登录无关
    }
//   跳转
    public static void teacRou(){
        int i=TeachList.list ();
        switch (i){
            case 1:TeacherJdbc.sava ();break;
            case 2:TeacherJdbc.dell ();break;
            case 3:Admincontrol.getInstance ().Rount ();break;
        }
    }

//    删除用户
    public static void teacReomve() {
        String id = TeachDell.teachDell ();
        if (teacheruse.containsKey ( id )) {
            teacheruse.remove ( id );
            teacRou ();
            System.out.println ( "删除成功" );
        }else {
            System.out.println ("被删除的用户不存在");
            teacRou ();
        }
    }

    public static Map<String, TeacherUser> getTeacheruse() {
        return teacheruse;
    }
}
